import httpx     # 导入第三方库：pip install httpx[http2]

headers = {
    "user-agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/139.0.0.0 Safari/537.36"
}
cookies = {
    "sessionid": "f94jzt0egz3k9b4wnb6zceoieh70e7vk"
}
url = "https://match.yuanrenxue.cn/api/match/17"


# 创建支持 HTTP/2 的客户端
client = httpx.Client(http2=True)

result_list = []
try:
    for i in range(1, 6):
        params = {
            "page": i
        }
        response = client.get(url=url,headers=headers,cookies=cookies,params=params)
        # print(f"状态码: {response.status_code}")
        
        datas = response.json()['data']
        for i in datas:
            result_list.append(i['value'])
finally:
    print(f"使用的协议: {response.http_version}")  # 输出 HTTP/2
    client.close()
print(sum(result_list))